package com.briup.day24;

import java.io.*;

public class Test_DataStream {
    public static void main(String[] args) throws Exception {
        DataOutputStream dos = new DataOutputStream(new FileOutputStream("01-Basic/src/dir/data.txt"));
        dos.writeInt(100);
        dos.writeLong(1L);//3个a三个字节
        dos.writeDouble(1.0);
        dos.writeBoolean(true);
        dos.writeChar('中');
        System.out.println("写入完成");
        dos.close();
        DataInputStream dis = new DataInputStream(new FileInputStream("01-Basic/src/dir/data.txt"));
        System.out.println(dis.readInt());
        System.out.println(dis.readLong());
        System.out.println(dis.readDouble());
        System.out.println(dis.readBoolean());
        System.out.println(dis.readChar());
        System.out.println("读取完成");
        dos.close();
    }
}
